package zm.irc.util;

import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;


public class Base64Util {
    private static final Logger log = Logger.getLogger(Base64Util.class);


    public static String encode(String src){
        if(StringUtils.isEmpty(src)){
            return null;
        }
        String base64Str = null;
        try{
            byte[] srcBytes = src.getBytes("utf-8");
            base64Str = java.util.Base64.getEncoder().encodeToString(srcBytes);
        }catch(Exception e){
            log.error("Base64 encode error! src :" + src, e);
        }

        
        return base64Str;
    }
}
